package tec.encode;


import java.io.FileOutputStream;
import java.util.Iterator;

public class CodeTableGenerator {
	public static void main(String[] args) throws Exception {
		new CodeTableGenerator().generate(new GB2312());
	}
	
	public void generate(Encode encode) throws Exception {
		FileOutputStream out = new FileOutputStream("txt/" + encode.getName() + ".txt");
		Iterator<Integer> codeItr = encode.iterator();

		System.out.println("Generate: " + encode.getName());
		while(codeItr.hasNext()) {
			out.write(ConvertUtil.toTwoByte(codeItr.next()));
		}
		out.flush();
		out.close();
	}
}
